package com.study.base

import android.os.Bundle
import android.view.View
import androidx.appcompat.app.AppCompatActivity


abstract class BaseActivity : AppCompatActivity() {

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        initBeforeContent()
        val layoutId = generateLayoutId()
        if (layoutId == 0) {
            val contentView: View? = generateContentView()
            setContentView(contentView)
        } else {
            setContentView(layoutId)
        }

        initView()
        initListener()
        initData()
    }

    open fun initBeforeContent() {

    }

    open fun generateLayoutId(): Int {
        return 0
    }

    open fun initData() {
    }

    open fun initListener() {
    }

    open fun initView() {
    }

    open fun generateContentView(): View? {
        return null
    }
}